<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Services\Admin\ClassQuarterly;
use App\Http\Requests\Admin\QuarterlyController\doRule;

class QuarterlyController extends Controller
{
    public function index()
    {
        $result = [
            'result' => ClassQuarterly::lists(1)->paginate(6),
        ];

        return view('admin.quarterly.index', $result);
    }

    public function add()
    {
        return view('admin.quarterly.edit');
    }

    public function do(doRule $request)
    {
        if ($request->ajax()) {

            $input = $request->all();

            $add = ClassQuarterly::add($input);
            if(!$add['bool'])return self::fail($add['message']);

            return self::success([]);

        }
    }

    public function del($id)
    {

        ClassQuarterly::del($id);

        return self::success([]);

    }
}
